<template>
  <div class="particular">
    <div class="title">《{{ particulars.programName }}》</div>
    <div class="times">
      {{ year }}年{{ month }}月{{ days }}日
    </div>
    <div class="content">
      {{{ particulars.programIntroduce }}}
    </div>
  </div>
  <toast v-show="loading" :type="'loading'">加载中</toast>
  <dialog v-show="dialog" :title="'错误提示'" :type="" @weui-dialog-confirm="dialog=false">
    <p>加载失败，请重试</p>
  </dialog>
</template>
<script>
  import {Toast, Dialog} from "vue-weui";
  import {AJAX} from "../methods/query.js";
  export default {
    data() {
      return {
        id: this.$route.query.id,
        loading: false,
        dialog: false,
        particulars: {},
        year: "1",
        month: "",
        days: ""
      };
    },
    async ready() {
      let programParticular = await AJAX.programParticular(this.id);
      let _self = this;
      _self.particulars = {
        programName: programParticular.programName,
        createTime: programParticular.createTime,
        programIntroduce: programParticular.programIntroduce
      };
      let date = new Date(_self.particulars.createTime);
      this.year = date.getFullYear(); // 获取完整的年份(4位,1970)
      _self.month = date.getMonth() + 1; // 获取月份()
      _self.days = date.getDate(); // 获取日(1-31)
      console.log(date.getMonth());
    },
    components: {
      Toast,
      Dialog
    }
  };
</script>
<style lang="less">
  .particular{
    background-color: #fff;
    padding:1rem .5rem 10rem .5rem;
    color:#404040;
    font-size: .8rem;
    .times{
      line-height: 1.5rem;
      color:#A6A6A6;
    }
    .content{
      font-size: .7rem;
      iframe{
        width:100% !important;
      }
      img{
        max-width: 100%;
      }
    }
  }
</style>
